home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / menus / mxmnu241.zip / NOVTRANS.MNU < prev    next >
Text File  |  1992-12-01  |  15KB  |  477 lines

  1. Comment
  2. ========================================================================
  3.  
  4. Novell menu to MarxMenu Translator:
  5.  
  6. Copyright 1989-92 by Marc Perkel * All rights reserved.
  7.  
  8. Usage: MARXMENU NOVTRANS <novell menu>
  9.  
  10. This program was written to translate Novell menus to MarxMenus. It is
  11. not an exact translation, but does the bulk of the work. It is up to you
  12. to edit the output file and tune the menu the way you want.
  13.  
  14. I have made no attempt to copy color information. I am not presenting
  15. selections in sorted order, but in the order in which they are defined.
  16.  
  17. If the translation is successful then your old menu will be renamed with
  18. a NOV extension.
  19.  
  20. ========================================================================
  21. EndComment
  22.  
  23. Var
  24.   Menus
  25.   MenuPtr
  26.   CommandPtr
  27.   LinePtr
  28.   ThisMenu
  29.   ThisChoice
  30.   BoxDim
  31.   VarNum
  32.   PromptLine
  33.   Out
  34.   Cap
  35.   InputAVar
  36.   NovellFileName
  37.   MarxMenuFileName
  38.   NovellTempFileName
  39.   NovFileExists
  40.   Greek
  41.   Titles
  42.   QuietMode
  43.   NovLines
  44.  
  45. ;----- Translator Messages
  46.  
  47. Const
  48.    TopMessage = "Joe Blow's Master Menu"
  49.    BottomMessage = "*-<< Acme Manufacturing Company >>-*"
  50.  
  51. ;----- If you want the Greek Column effect, set to true
  52.  
  53. Greek = False
  54.  
  55. Qualifier MenuName MenuTitle YPos XPos MenuColor MenuChoices
  56. Qualifier ChoiceName ChoiceCmd
  57.  
  58. Comment
  59. ========================================================================
  60.  
  61. This is the main body of the NovTrans Program.
  62.  
  63. ========================================================================
  64. EndComment
  65.  
  66. if not NetWorkVersion
  67.    ClearScreen
  68.    Writeln
  69.    Writeln 'This translator requires the network version of MarxMenu to Run!'
  70. endif
  71.  
  72. PreAmble
  73. GetFileNames
  74. Parse
  75. if MenuPtr = 0
  76.    Writeln
  77.    Writeln
  78.    Writeln 'Error: ' NovellTempFileName ' is not a Novell menu!
  79.    ExitMenu
  80. endif
  81. Header
  82. WriteOutMenus
  83. Footer
  84.  
  85. ClearScreenFirst Off
  86. Writeln
  87.  
  88. if QuietMode
  89.    Execute 'MARXCOMP.EXE ' + MarxMenuFileName + ' /U'
  90. else
  91.    Execute 'MARXCOMP.EXE ' + MarxMenuFileName
  92. endif
  93.  
  94. if ReturnCode = 0
  95.    Writeln
  96.    Writeln 'Menu Translation Sucessful!'
  97.    Writeln
  98.    if not NovFileExists and not QuietMode
  99.       Writeln 'Renaming ' NovellTempFileName ' to ' ForceExtension(NovellTempFileName,'NOV')
  100.       FileRename(NovellTempFileName,ForceExtension(NovellTempFileName,'NOV'))
  101.       Writeln 'Renaming ' MarxMenuFileName ' to ' NovellTempFileName
  102.       FileRename(MarxMenuFileName,NovellTempFileName)
  103.       Writeln
  104.       Write 'Your original novell menu has been renamed to: '
  105.       Writeln ForceExtension(NovellTempFileName,'NOV')
  106.       Writeln
  107.    endif
  108.    Writeln 'To test your menu type MARX ' NovellFileName '.
  109. endif
  110.  
  111. ExitMenu
  112.  
  113. Comment
  114. =====================================
  115.  
  116. Subroutine area.
  117.  
  118. =====================================
  119. EndComment
  120.  
  121. ;----- Initilize Variables and Environment
  122.  
  123. Procedure PreAmble
  124.    ClearScreenOnExit Off
  125.    if UpperCase(ParamStr(3)) = 'U'
  126.       Quietmode = True
  127.       OutFile = 'NUL'
  128.    endif
  129.    StandardIO
  130.    Writeln
  131.    NovellFileName = UpperCase(ParamStr(2))
  132.    if Extension(NovellFileName) = 'MNU'
  133.       length(NovellFileName) = length(NovellFileName) - 4
  134.    endif
  135.    Usage
  136. EndProc
  137.  
  138. ;----- Proper Usage Procedure
  139.  
  140. Procedure Usage
  141.    if NovellFileName = ''
  142.       Writeln('Converts Novell menus to MarxMenus.')
  143.       Writeln
  144.       Writeln('  Usage: MarxMenu NovTrans <menu>')
  145.       ExitMenu
  146.    endif
  147. EndProc
  148.  
  149. ;----- Get File Names
  150.  
  151. Procedure GetFileNames
  152.    if pos('.',NovellFileName) = 0
  153.       if QuietMode
  154.          NovellTempFileName = ForceExtension(NovellFileName,'MNU')
  155.       else
  156.          NovellTempFileName = ForceExtension(NovellFileName,'NOV')
  157.          if ExistOnPath(NovellTempFileName) = ''
  158.             NovellTempFileName = ForceExtension(NovellFileName,'MNU')
  159.          else
  160.             NovFileExists = True
  161.          endif
  162.       endif
  163.  
  164.    endif
  165.  
  166.    NovellTempFileName = ExistOnPath(NovellTempFileName)
  167.  
  168.    if NovellTempFileName = ''
  169.       Writeln 'Error: ' NovellFileName ' does not exist!'
  170.       ExitMenu
  171.    endif
  172.  
  173.    if NovFileExists
  174.       MarxMenuFileName = ForceExtension(NovellTempFileName,'MNU')
  175.    else
  176.       MarxMenuFileName = ForceExtension(NovellTempFileName,'TMP')
  177.    endif
  178.  
  179.    ReadTextFile(NovellTempFileName,NovLines)
  180.    Writeln 'Creating ' MarxMenuFileName
  181. EndProc
  182.  
  183.  
  184. Procedure BlankLine
  185.    FileWriteln(Out,'')
  186. EndProc
  187.  
  188. ;----- Write out the MarxMenu Source Header
  189.  
  190. Procedure Header
  191.   FileAssign(Out,MarxMenuFileName)
  192.   FileCreate(Out)
  193.   BlankLine
  194.   FileWriteln(Out,'Comment')
  195.   FileWriteln(Out,'==========================================================')
  196.   BlankLine
  197.   FileWriteln(Out,'This File was converted from Novell Menu: ',NovellTempFileName)
  198.   BlankLine
  199.   FileWriteln(Out,'It should behave in a similar way to the original menu but')
  200.   FileWriteln(Out,'not necessarilly exactly the same. It will be close enough')
  201.   FileWriteln(Out,'for you to fine tune it the way you want.')
  202.   BlankLine
  203.   FileWriteln(Out,'To add a choice to a menu simply use the AddChoice command')
  204.   FileWriteln(Out,'then add the appropiate Onkey statement.')
  205.   FileWriteln(Out,'The menu will make the size adjustments accordinaly.')
  206.   BlankLine
  207.   FileWriteln(Out,'  Example:')
  208.   FileWriteln(Out,'      AddChoice("Print Console",10)')
  209.   FileWriteln(Out,'      ... ')
  210.   FileWriteln(Out,'      ... ')
  211.   FileWriteln(Out,'      OnKey Task(10)')
  212.   FileWriteln(Out,'        cd \public')
  213.   FileWriteln(Out,'        PConsole')
  214.   FileWriteln(Out,'      ...')
  215.   BlankLine
  216.   FileWriteln(Out,"If you want to change the menu's center, pass the XY")
  217.   FileWriteln(Out,"coordinates to menu's CenterStretchBox procedure.")
  218.   BlankLine
  219.   FileWriteln(Out,'   Example:')
  220.   FileWriteln(Out,'      CenterStretchBox("Menu Header",40,12)')
  221.   BlankLine
  222.   FileWriteln(Out,'This will cause the menu to center at Col 40, Row 12')
  223.   BlankLine
  224.   FileWriteln(Out,'Instead of defining the center of the box, there is a command')
  225.   FileWriteln(Out,'CornerStretchBox where the box grows down and right.')
  226.   BlankLine
  227.   FileWriteln(Out,'   Example:')
  228.   FileWriteln(Out,'      CornerStretchBox("Menu Header",8,6)')
  229.   BlankLine
  230.   FileWriteln(Out,'To control custom features, edit CUSTOM.INC and other INCLUDE Files.')
  231.   BlankLine
  232.   FileWriteln(Out,'=========================================================')
  233.   FileWriteln(Out,'EndComment')
  234.   BlankLine
  235.   FileWriteln(Out,';----- Create Variables')
  236.   BlankLine
  237.   FileWriteln(Out,'var')
  238.   FileWriteln(Out,'  NovVar')
  239.   FileWriteln(Out,'  KeepUsersInMenu')
  240.   BlankLine
  241.   BlankLine
  242.   FileWriteln(Out,';----- Here is where you add you own menu title and status line message')
  243.   BlankLine
  244.   FileWriteln(Out,'MenuTitle      = "',TopMessage,'"')
  245.   FileWriteln(Out,'StatusLineText = "',BottomMessage,'"')
  246.   BlankLine
  247.   FileWriteln(Out,';----- Load Novell look and feel routines')
  248.   BlankLine
  249.   FileWriteln(Out,'Include "CUSTOM.INC"')
  250.   if Greek then FileWriteln(Out,'Greek = True')
  251.   BlankLine
  252.   FileWriteln(Out,'KeepUsersInMenu Off  ;Change to On to keep users in menu.')
  253.   BlankLine
  254.   FileWriteln(Out,'Comment')
  255.   FileWriteln(Out,'=================================')
  256.   BlankLine
  257.   FileWriteln(Out,'MarxMenu is capable of software metering. This means that it can')
  258.   FileWriteln(Out,'limit the number of users of an application to a fixed amount.')
  259.   BlankLine
  260.   FileWriteln(Out,'  OnKey Task (2)')
  261.   FileWriteln(Out,"     |if Limit('LOTUS',6) then Return ;limit Lotus to 6 Users")
  262.   FileWriteln(Out,'     CD \PUBLIC\LOTUS')
  263.   FileWriteln(Out,'     123')
  264.   BlankLine
  265.   FileWriteln(Out,'Read the METER.INC file for more details.')
  266.   BlankLine
  267.   FileWriteln(Out,'=================================')
  268.   FileWriteln(Out,'EndComment')
  269.   BlankLine
  270.   FileWriteln(Out,"Include 'METER.INC'  ;Software Metering")
  271.   BlankLine
  272.   FileWriteln(Out,'Comment')
  273.   FileWriteln(Out,'=================================')
  274.   BlankLine
  275.   FileWriteln(Out,'In order to add menu choices conditionally you would append the')
  276.   FileWriteln(Out,'choices to the end of the array after all the default choices')
  277.   FileWriteln(Out,'are